package cn.com.okgo.callback;


import java.io.File;

import cn.com.okgo.convert.ImageConver;
import okhttp3.Response;
import okhttp3.ResponseBody;

/**
 * Created by luwenlong on 2017/5/16.
 *
 * 返回图片
 */

public abstract class HttpImageCallback extends HttpCallback<File> {

    private ImageConver convert;    //文件转换类

    public HttpImageCallback(String fileDir, String fileName) {
        convert = new ImageConver(fileDir, fileName);
    }


    @Override
    public File parseNetworkResponse(Response response) throws Exception {
        File file = convert.convertSuccess(response);
        response.close();
        return file;
    }

    @Override
    public File parseCacheResponse(ResponseBody responseBody) throws Exception {
        return null;
    }
}
